﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Idlesoft.Cli
{
	public interface ICliVirtue
	{
		/// <summary>
		/// Boolean property to determine if the virtue is an Option as opposed to a BuiltIn or Required.
		/// </summary>
		bool Option { get; }

		/// <summary>
		/// Boolean property to determin if the virtue is decorating the CliBuilder class instead of a user-defined one.
		/// </summary>
		bool BuiltIn { get; }

		/// <summary>
		/// Optional boolean property to mark a virtue as required.  This will cause an error to happen and the usage to print if it is not set during CliBuilder.Create.
		/// </summary>
		bool Required { get; set; }

		/// <summary>
		/// Optional property to override the default flag types as defined during the call to CliBuilder.Create or its default value.  This governs how and how many of the flags are auto-generated.
		/// </summary>
		FlagTypes FlagTypes { get; set; }

		/// <summary>
		/// Optional property to override the name of the property.  This overridden Name is then used when auto-generating the flags to match against.
		/// </summary>
		string Name { get; set; }

		/// <summary>
		/// Optional property used when the help usage prints to the console on bad input are when invoked.
		/// </summary>
		string Description { get; set; }

		/// <summary>
		/// Optional string array of flags to be used to match against.  This turns off the auto-generated flags irrespectives of the FlagTypes etc.
		/// </summary>
		string[] Flags { get; set; }

		/// <summary>
		/// Internal property used to store the values once they have been parsed out of the command line args.  Do not attempt to set this property.
		/// </summary>
		object[] Values { get; set; }

		/// <summary>
		/// Optional property to supply default values to be used when no values are found during parsing.  Note that this will not be used for virtues marked as Required.
		/// </summary>
		object Default { get; set; }

		/// <summary>
		/// Internal property to store the MemberInfo loaded during the CliBuilder.Create execution.  Do not attempt to set this property.
		/// </summary>
		MemberInfo MemberInfo { get; set; }

		/// <summary>
		/// Internal property to get the type of the property|field that the MemberInfo property points to.  Will throw an exception if MemberInfo is not set.
		/// </summary>
		Type MemberInfoType { get; }

		/// <summary>
		/// Internal method to determin if a virtue has been assigned.  Checks against the default values; this will probably be improved to be more accurate.
		/// </summary>
		/// <param name="target">The target object that the MethodInfo property is point to.</param>
		/// <returns></returns>
		bool IsAssigned(object target);
	}
}
